package com.dalongxin.work.data;

import org.json.JSONArray;
import org.json.JSONObject;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * 合同审批和合同评审Bean
 */
public class DjHtsp implements Serializable {

    private int id;
    private int companyId;
    private String companyName;
    private int projectId;
    private String projectName;
    private String fillDate;
    private String contractName;
    private int supplierId;
    private String supplierName;
    private String contractNumber;
    private int invoiceType;
    private String expiryDate;
    private String goodsAddress;
    private String goodsName;
    private double contractTotal;
    private String payType;
    private String remark;
    private int approveId1;
    private String approveName1;
    private int approveId2;
    private String approveName2;
    private int status;
    private int createId;
    private String createName;
    private String createTime;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getCompanyId() {
        return companyId;
    }

    public void setCompanyId(int companyId) {
        this.companyId = companyId;
    }

    public String getCompanyName() {
        return companyName;
    }

    public void setCompanyName(String companyName) {
        this.companyName = companyName;
    }

    public int getProjectId() {
        return projectId;
    }

    public void setProjectId(int projectId) {
        this.projectId = projectId;
    }

    public String getProjectName() {
        return projectName;
    }

    public void setProjectName(String projectName) {
        this.projectName = projectName;
    }

    public String getFillDate() {
        return fillDate;
    }

    public void setFillDate(String fillDate) {
        this.fillDate = fillDate;
    }

    public String getContractName() {
        return contractName;
    }

    public void setContractName(String contractName) {
        this.contractName = contractName;
    }

    public int getSupplierId() {
        return supplierId;
    }

    public void setSupplierId(int supplierId) {
        this.supplierId = supplierId;
    }

    public String getSupplierName() {
        return supplierName;
    }

    public void setSupplierName(String supplierName) {
        this.supplierName = supplierName;
    }

    public String getContractNumber() {
        return contractNumber;
    }

    public void setContractNumber(String contractNumber) {
        this.contractNumber = contractNumber;
    }

    public int getInvoiceType() {
        return invoiceType;
    }

    public void setInvoiceType(int invoiceType) {
        this.invoiceType = invoiceType;
    }

    public String getExpiryDate() {
        return expiryDate;
    }

    public void setExpiryDate(String expiryDate) {
        this.expiryDate = expiryDate;
    }

    public String getGoodsAddress() {
        return goodsAddress;
    }

    public void setGoodsAddress(String goodsAddress) {
        this.goodsAddress = goodsAddress;
    }

    public String getGoodsName() {
        return goodsName;
    }

    public void setGoodsName(String goodsName) {
        this.goodsName = goodsName;
    }

    public double getContractTotal() {
        return contractTotal;
    }

    public void setContractTotal(double contractTotal) {
        this.contractTotal = contractTotal;
    }

    public String getPayType() {
        return payType;
    }

    public void setPayType(String payType) {
        this.payType = payType;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public int getApproveId1() {
        return approveId1;
    }

    public void setApproveId1(int approveId1) {
        this.approveId1 = approveId1;
    }

    public String getApproveName1() {
        return approveName1;
    }

    public void setApproveName1(String approveName1) {
        this.approveName1 = approveName1;
    }

    public int getApproveId2() {
        return approveId2;
    }

    public void setApproveId2(int approveId2) {
        this.approveId2 = approveId2;
    }

    public String getApproveName2() {
        return approveName2;
    }

    public void setApproveName2(String approveName2) {
        this.approveName2 = approveName2;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public int getCreateId() {
        return createId;
    }

    public void setCreateId(int createId) {
        this.createId = createId;
    }

    public String getCreateName() {
        return createName;
    }

    public void setCreateName(String createName) {
        this.createName = createName;
    }

    public String getCreateTime() {
        return createTime;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }

    public static DjHtsp parseFromJson(JSONObject jsonObj) {
        DjHtsp object = new DjHtsp();
        object.id = jsonObj.optInt("id");
        object.companyId = jsonObj.optInt("companyId");
        object.companyName = jsonObj.optString("companyName");
        object.projectId = jsonObj.optInt("projectId");
        object.projectName = jsonObj.optString("projectName");
        object.fillDate = jsonObj.optString("fillDate");
        object.contractName = jsonObj.optString("contractName");
        object.supplierId = jsonObj.optInt("supplierId");
        object.supplierName = jsonObj.optString("supplierName");
        object.contractNumber = jsonObj.optString("contractNumber");
        object.invoiceType = jsonObj.optInt("invoiceType");
        object.expiryDate = jsonObj.optString("expiryDate");
        object.goodsAddress = jsonObj.optString("goodsAddress");
        object.goodsName = jsonObj.optString("goodsName");
        object.contractTotal = jsonObj.optDouble("contractTotal");
        object.payType = jsonObj.optString("payType");
        object.remark = jsonObj.optString("remark");
        object.approveId1 = jsonObj.optInt("approveId1");
        object.approveName1 = jsonObj.optString("approveName1");
        object.approveId2 = jsonObj.optInt("approveId2");
        object.approveName2 = jsonObj.optString("approveName2");
        object.status = jsonObj.optInt("status");
        object.createId = jsonObj.optInt("createId");
        object.createName = jsonObj.optString("createName");
        object.createTime = jsonObj.optString("createTime");
        object.contractName = jsonObj.optString("contractName");
        return object;
    }

    public static List<DjHtsp> parseFromJsonList(JSONArray jsonArray) {
        List<DjHtsp> list = new ArrayList<>();
        if(jsonArray != null && jsonArray.length() > 0) {
            for(int i=0;i<jsonArray.length();i++) {
                DjHtsp item = parseFromJson(jsonArray.optJSONObject(i));
                if(item != null)list.add(item);
            }
        }
        return list;
    }
}
